<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    /* .up {
      display: none;
    }
    .box {
      width: 100px;
      height: 100px;
      background: green;
    } */
  </style>
  <body>
    <!-- <div class="box"></div> -->
    <form
      action="http://8.141.145.150:3000/upload/upimgs"
      enctype="multipart/form-data"
      method="post"
      class="up"
    >
      <input type="file" name="img" />
      <button class="submit">上传</button>
    </form>
  </body>
</html>
<script>
  //   let dom = document.querySelector(".box");
  //   let upInput = document.querySelector("input");
  //   dom.onclick = function () {
  //     // console.log(upInput);
  //     upInput.click();
  //   };
  //   upInput.onchange = function (e) {
  //     // console.log(this.value);
  //     // let form = document.querySelector("form");
  //     console.log(this.files);
  //   };
  let submit = document.querySelector(".submit");
  submit.onclick = function (e) {
    this.stopPropagation(); // 阻止默认事件
  };

  var x = 1,
    y = 0,
    z = 0;
  //   function add(n) {
  //     // 当函数没有返回值的时候 应该是一个 undefind
  //     n = n + 1;
  //   }
  //   y = add(x);
  //   z = x + y;
  //   console.log("y1" + y); // 2   0
  //   console.log("z1" + z); // 3   4

  function add(n) {
    n = n + 3;
  }
  y = add(x);
  z = x + y;
  console.log("y2" + y); // 4
  console.log("z2" + z); // 5
</script>
